#pragma once
#include "PDTStatement.h"
#include "PDTAssign.h"
#include "PDTNumVar.h"
#include "PDTCodeGraph.h"
#include <stack>
class PDTListOfStatements :  public PDTStatement, public TraverseIfc <PDTListOfStatements, PDTNode> { public:  TRAVERSAL_IFC_IMPL(PDTListOfStatements)
public:
	void addStatement(PDTStatement &newStatement);
	PDTListOfStatements(PDTCodeGraph & CG);
	PDTListOfStatements(PDTCodeGraph & CG, PDTStatement &newStatement);
			PDTListOfStatements(PDTCodeGraph & CG,
					vector<PDTStatement*> &statementList);
	NodeTypeEnum getType() {
		return PDTListOfStatements_Em;
	}
	bool isListOfStatements() {
		return true;
	}

	virtual bool eval(PDTCodeGraph &CG) ;

	virtual unsigned int numberOfStmts() const
	{
		return children.size();
	}

	virtual PDTStatement* getStatmentAt(int i)
	{
		return dynamic_cast<PDTStatement*>(children[i]);
	}

	virtual PDTNode* clone(PDTCodeGraph& CG)
	{
		PDTNode* toReturn;
		vector<PDTStatement*> statementsListClone;
		for (unsigned int i=0; i<children.size(); i++)
			statementsListClone.push_back((PDTStatement*)(children[i]->clone(CG)));
		toReturn = new PDTListOfStatements(CG, statementsListClone);
		return toReturn;
	}

	virtual stringstream & toString(stringstream & ss) const {
		int size = children.size();
		for (int i = 0; i < size; i++) {
			PDTNode * node = children[i];
			node->toString(ss);
			ss << endl;
		}
		return ss;
	}

};
